package org.jeecg.modules.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.entity.DiyProfessorScore;
import org.jeecg.modules.entity.ProjectPictureInfo;
import org.jeecg.modules.entity.Serializable;
import org.jeecg.modules.mapper.DiyProfessorScoreMapper;
import org.jeecg.modules.service.DiyProfessorScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DiyProfessorInScoreServiceImpl extends ServiceImpl<DiyProfessorScoreMapper, DiyProfessorScore> implements DiyProfessorScoreService {

    @Autowired DiyProfessorScoreMapper diyProfessorScoreMapper;

    @Override
    public IPage<DiyProfessorScore> pageByEntity(Page<DiyProfessorScore> page, DiyProfessorScore diyProfessorScore ) {
        List<DiyProfessorScore> list = diyProfessorScoreMapper.pageByEntity(diyProfessorScore);
        list.forEach((info)->{
            System.out.println(info.getProfessorDeclareCategory());
            info.setProfessorDeclareCategoryName(diyProfessorScoreMapper.selMajorNameById(info.getProfessorDeclareCategory()));
            System.out.println(info);
        });
        page.setRecords(list);
        return page;
    }

    @Override
    public List<ProjectPictureInfo> getTotal(Serializable Serializable) {
        List<ProjectPictureInfo> list = diyProfessorScoreMapper.getTotal(Serializable);
        return list;

    }
}
